package com.wangs.controller;

import jakarta.validation.constraints.Min;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/items")
@Validated // 放在类级别
public class ItemController {

    @GetMapping("/{id}")
    public ResponseEntity<String> getItemById(@PathVariable("id") @Min(1) Long id) {
        return ResponseEntity.ok("获取物品成功，ID: " + id);
    }
}
